<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('考试名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('考试时间')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input class="form-control daterange" name="row[time]" type="text" value="" readonly>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('学校')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="school">
                <select class="form-control school" name="row[school_id]" data-url="common/schools" data-rule="required"></select>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('年级')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline" data-toggle="cxselect" data-selects="grade">
                <select class="form-control grade" name="row[grade_id]" data-url="common/grades" data-rule="required"></select>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('科目')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div id="subject"></div>
            <table class="table">
                <caption>请设置科目相应的分数线数值.</caption>
                <thead>
                <tr>
                    <th>科目</th>
                    <th>满分</th>
                    <th>优良分</th>
                    <th>及格分</th>
                </tr>
                </thead>
                <tbody id="subject_body">
                <tr class="subject_total">
                    <input type="hidden" name="row[subjects][0][id]" value="0">
                    <td><input type="text" name="row[subjects][0][name]" value="总分" readonly style="border:none;"></td>
                    <td><input type="number" name="row[subjects][0][full_score]" value="100" data-rule="require"></td>
                    <td><input type="number" name="row[subjects][0][excellent_score]" value="90" data-rule="require"></td>
                    <td><input type="number" name="row[subjects][0][pass_score]" value="60" data-rule="require"></td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('下载模板')}:</label>
        <div class="col-xs-12 col-sm-8">
            <a class="download" style="line-height: 31px;" href="javascript:;">点击下载</a>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('导入')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-files" data-rule="required" class="form-control" size="50" name="row[file]" type="text" value="" readonly>
                <div class="input-group-addon no-border no-padding">
                    <span>
                        <button type="button" id="plupload-files" class="btn btn-danger plupload" data-url="{:url('ajax/upload')}" data-input-id="c-files" data-mimetype="csv,xls,xlsx" data-multiple="false" data-preview-id="p-files">
                        <i class="fa fa-upload"></i> {:__('导入')}
                        </button>
                    </span>
                </div>
                <span class="msg-box n-right" for="c-files"></span>

            </div>
        </div>
    </div>


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script id="tpl_subject" type="text/html">
    <%for(var i=0; i< data.length; i++){%>
    <label>
        <input type="checkbox" class="subject" name="row[subjects][<%=data[i].id%>][id]" value="<%=data[i].id%>" data-id="<%=data[i].id%>" data-name="<%=data[i].name%>"> <%=data[i].name%>
    </label>
    <%}%>
</script>

<script id="tpl_subject_body" type="text/html">
    <tr class="subject_<%=id%>">
        <td><input type="text" name='row[subjects][<%=id%>][name]' value="<%=name%>" readonly style="border:none;"></td>
        <td><input type="number" name='row[subjects][<%=id%>][full_score]' value="100" data-rule="require"></td>
        <td><input type="number" name='row[subjects][<%=id%>][excellent_score]' value="90" data-rule="require"></td>
        <td><input type="number" name='row[subjects][<%=id%>][pass_score]' value="60" data-rule="require"></td>
    </tr>
</script>






